﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<SDT.Mobile.Models.ProductModels>" %>
<%@ Import Namespace="SDT.Lib.Helpers" %>
<div class="top_tinrao">
    <strong><%=ViewData["Title"] %></strong>
</div>
<div class="new_list">
    <ul>
    	<%var lFull = Model.Products.Count > 6 ? Model.Products.Skip(0).Take(6).ToList() : Model.Products.ToList();
            var lSort = Model.Products.Count > 6 ? Model.Products.Skip(6).ToList() : null;
            foreach (var item in lFull)
       {
           var pathDetail = item.ProductCategory.Name + " tại " + item.District.Name + " " + item.City.Name;
           var dpath = "/" + Html.ToUrlFriendly(pathDetail) + "/" + Html.ToUrlFriendly(item.Title) + "-p-" + item.ID + ".html";
           %>
    	<li>        	
            <a href="<%=dpath %>" class="l_blue">
                <%=Html.Encode(item.Title) %>(<%=Html.Encode(item.AddDate.Value.ToString("dd/MM/yyyy")) %>)
            </a>
        </li>
        <%} %>        
    </ul>
</div>
<%if (lSort != null)
  { %>
<div class="top_tinrao">
    <div class="tit_not_bg" style="margin-top:3px;">
        <span class="next" id="showNext"><strong>Xem tiếp</strong> </span>
    </div>
</div>
<div class="new_list" id="next">
    <ul>
        <%
            
            foreach (var item in lSort)
    {
        var pathDetail = item.ProductCategory.Name + " tại " + item.District.Name + " " + item.City.Name;
        var dpath = "/" + Html.ToUrlFriendly(pathDetail) + "/" + Html.ToUrlFriendly(item.Title) + "-p-" + item.ID + ".html";
        %>
        <li><a href="<%=dpath %>" class="l_blue">
            <%= item.Title%></a> </li>
        <%} %>
    </ul>
</div>
<script type="text/javascript">

    $(document).ready(function() {
        $("#next").hide();
        $('#showNext').toggle(function() {
            $("#next").show();
        }, function() {
            $("#next").hide();
        });
    });
    </script>
<%} %>

